#ifndef  	__IPZ_ZBC_PRIVACY_H_
#define		__IPZ_ZBC_PRIVACY_H_

#include "ipz_zbc_api.h"

#ifdef	IPZ_ZBC_PRIVACY_GLOBAL
	#define	PRIVACY_EXT	
#else
	#define	PRIVACY_EXT		extern
#endif


#define	PI 3.1415926

#define WIDTH   1000//1920
#define HEIGHT  1000//1080
#define GRATIO  0.5625

typedef struct _LENS_ATTR
{
    SW_UINT32 sonycoord;                       
    SW_FLOAT horAngle;   //水平视场角                   
    SW_FLOAT verAngle;   //垂直视场角              
                  
}CamViewAngle;



typedef struct
{
	SW_FLOAT verAngleHalf;
	SW_FLOAT horAngleHalf;
}CamAngleOfView;


typedef struct
{
	SW_FLOAT x1;
	SW_FLOAT y1;
}CamPavPiexl;

typedef struct
{
	SW_FLOAT xAngle;
	SW_FLOAT yAngle;
}CamPavAngle;

typedef struct
{
	SW_FLOAT panDX1;
	SW_FLOAT tiltDY1;
	SW_FLOAT panDX2;
	SW_FLOAT tiltDY2;
    SW_FLOAT panDX3;
	SW_FLOAT tiltDY3;
    SW_FLOAT panDX4;
	SW_FLOAT tiltDY4;
	SW_INT   zoom;
}CamPavPTZAngle;


typedef struct
{
	//PrivacyMaskBodyDef maskBody;
	SW_UINT16	HA; // Xstart 对于-E
	SW_UINT16	VA; // Ystart 对于-E
	SW_UINT16	HB; // Xend 对于-E
	SW_UINT16	VB; // Yend 对于-E
	SW_UINT16	HC;
	SW_UINT16	VC;
	SW_UINT16	HD;
	SW_UINT16   VD;
	SW_UINT8    color;
	SW_UINT8    ratio;
	SW_UINT8    mosic;
	SW_BOOL     bOpen;
}CamPavMaskBlockDef;


typedef struct
{
    SW_INT  Nflag;
	SW_INT	Nxa;
	SW_INT  Nya;
	SW_INT	Nxb;
	SW_INT	Nyb;
    SW_INT	Nxc;
	SW_INT  Nyc;
	SW_INT	Nxd;
	SW_INT	Nyd;
}CamPavNewPointMask;



typedef struct VIDEO_POINT
{
    SW_INT s32X;
    SW_INT s32Y;
} VIDEO_POINT;

typedef struct VIDEO_QUADRANGLE
{
    SW_BOOL bSolid;            		/* whether solid or dashed quadrangle */
    SW_UINT32 u32Thick;           	/* Line Width of quadrangle, valid when dashed quadrangle */
    VIDEO_POINT stPoint[4];        	/* points of quadrilateral */
}VIDEO_QUADRANGLE;
typedef struct VIDEO_QUADRANGLE_COVER_PARAM
{
	/// 覆盖的矩形区域，采用相对坐标体系。
	VIDEO_QUADRANGLE	stQuadRangle;

	/// 被覆盖区域显示的颜色。16进制表示为0x00BBGGRR，最高字节保留。
	SW_UINT32		color;

	/// 区域操作的类型， 取video_cover_t类型的值。窗口和全屏操作应该是独立的， 
	/// 即窗口内的操作不影响全屏，全屏内的操作也不影响窗口。 清除区域时，其他
	/// 参数被忽略。
	SW_INT			enable;
    SW_UINT32       zoomdownlimit;
}VIDEO_QUADRANGLE_COVER_PARAM;

PRIVACY_EXT CamAngleOfView AngOfView;
PRIVACY_EXT CamPavAngle Angle;
PRIVACY_EXT CamAngleOfView AngleOfPT[8];
PRIVACY_EXT CamAngleOfView AngleOfPTUpdate;
PRIVACY_EXT CamPavPTZAngle PTZAngle[8];
PRIVACY_EXT	CamPavNewPointMask CamPavNewPoint[8];
PRIVACY_EXT CamPavPiexl Piexl;
PRIVACY_EXT CamPavMaskBlockDef CamMask[8];
PRIVACY_EXT SW_FLOAT g_horAngleHalf[8];

void IPZ_ZBC_PRIVACY_Thread(void);
extern void IPZ_ZBC_PRIVACY_GetViewAngle(int zoom);
extern void IPZ_ZBC_PRIVACY_Image2World(int index,SW_INT cnterX, SW_INT CnterY);
extern void IPZ_ZBC_PRIVACY_World2Image( SW_FLOAT aVV, SW_FLOAT aVH, SW_FLOAT aMH, SW_FLOAT aMV);
extern void IPZ_ZBC_PRIVACY_Image2WorldAngle(SW_INT index);
extern void IPZ_ZBC_PRIVACY_WorldAngle2NewImage(SW_INT index);
extern void IPZ_ZBC_PRIVACY_UpdatePrivacy(SW_INT index);
extern void IPZ_ZBC_PRIVACY_UpdatePrivacyTotal(void);
extern void IPZ_ZBC_PRIVACY_SetCover(SW_INT index,int zoom);
extern void IPZ_ZBC_PRIVACY_SetOsdCover(int index,VIDEO_QUADRANGLE_COVER_PARAM *stCoverParam);

SW_INT IPZ_ZBC_PRIVACY_SetPrivacy(IPZ_ZBC_PRIVACY_PARAM_ARM *privymask, int id);
SW_INT IPZ_ZBC_PRIVACY_SetPrivacyInfo(IPZ_ZBC_PRIVACY_PARAM_ARM *privymask);
int IPZ_ZBC_PRIVACY_DelAllPrivy();/*删除所有隐私块信息 */
int IPZ_ZBC_PRIVACY_DelOnePrivy(int id);/*删除单个隐私块*/
unsigned char IPZ_ZBC_PRIVACY_GetPrivyWholeEnable();/*获取总隐私使能标志*/
void IPZ_ZBC_PRIVACY_SetPrivyWholeEnable(unsigned char wholeEnable);
unsigned char IPZ_ZBC_PRIVACY_GetPrivyOneEnable(int id);
int IPZ_ZBC_PRIVACY_DelAllPrivyInfo();
#endif
